# Maintainer: Dekedro <dekedro@tankers.xyz>
pkgname=espeak-ng
pkgver=1.50
pkgrel=0
pkgdesc="Multi-lingual software speech synthesizer"
url="https://github.com/espeak-ng/espeak-ng"
arch="all !s390x" # Fails to build on s390x
license="GPL-3.0-or-later"
makedepends="autoconf automake libtool pcaudiolib-dev ronn"
subpackages="$pkgname-dev $pkgname-doc $pkgname-vim::noarch"
source="$pkgname-$pkgver.tar.gz::https://github.com/espeak-ng/espeak-ng/archive/refs/tags/$pkgver.tar.gz
	fix-samplerate-definition-699.patch::https://github.com/espeak-ng/espeak-ng/commit/e11cd42b03d1628f7a0cf45c9406123282e25c63.patch
	fix-grc-handling-690.patch
	fix-newline-expansion.patch
	disable-failing-test-784.patch"

prepare() {
	default_prepare
	./autogen.sh
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var
	make -j1
}

check() {
	make -j1 check
}

package() {
	make DESTDIR="$pkgdir" install
}

vim() {
	pkgdesc="$pkgdesc (vim syntax)"
	install_if="$pkgname=$pkgver-r$pkgrel vim"

	amove /usr/share/vim
}

sha512sums="
297dd80a6cdae3e2b8acf6823475220ce89d6a5fb68ea303156ad52cb3e7388049b6921759d4ed4e3d2e2ebd19bf931259e454f74a2ac0b7ecf4ce56c1d60c0c  espeak-ng-1.50.tar.gz
9270fdcfb1f94108f0ac2109a66491df0c0f60183c500ba4dbf1db6734d4d8dae14aacb967499566ae726ba545e82f869a39a4dd7e3900ba8c4ab066f02f5e46  fix-samplerate-definition-699.patch
f1d4fe9c45c1b7130303f8eaadf4e6331c8f82bb249ceeb40b015f02515ed78ba91b682e537301ab22528bc9e173ac3e5fed29136f8738794f88b8699bf3633d  fix-grc-handling-690.patch
b64e22b51ce17eedc2e35a52e3f1a74e6f6c8668738c97f0736544764b48c881edf9cd8ca3fb6c2341588ccb411d76d1cc127d48a5d7fc47a7aa94142f3e1a26  fix-newline-expansion.patch
0886ac3511536f259d59ce76277585c0406fa788feea6032a05d33ca1c2720f51faf60fd36dfa4bcccfdea0cb88f916af6cf4a77f4602b7f0aea45856d424f4e  disable-failing-test-784.patch
"
